package com.greet.mapper;

import com.greet.annotation.AutoFill;
import com.greet.dto.CategoryPageQueryDTO;
import com.greet.entity.Category;
import com.greet.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CategoryMapper {

    @AutoFill(OperationType.UPDATE)
    void update(Category category);

    List<Category> select(Category category);

    List<Category> selectPageQuery(CategoryPageQueryDTO categoryPageQueryDTO);

    @Select("select count(0) from category")
    long countAll();

    @AutoFill(OperationType.INSERT)
    void insert(Category category);

    @Delete("delete from category where id = #{id}")
    void deleteById(Long id);
}
